package org.linlinjava.litemall.db.service;

import com.github.yulichang.base.MPJBaseServiceImpl;
import org.linlinjava.litemall.db.dao.LumiereLevelMemberPointMapper;
import org.linlinjava.litemall.db.domain.LumiereLevelMember;
import org.linlinjava.litemall.db.domain.LumiereLevelMemberPoint;
import org.linlinjava.litemall.db.domain.LumiereLevelMemberPointExample;
import org.springframework.stereotype.Service;

import javax.annotation.Resource;
import java.util.List;

@Service
public class LumiereLevelMemberPointService extends MPJBaseServiceImpl<LumiereLevelMemberPointMapper,LumiereLevelMemberPoint> {

    @Resource
    private LumiereLevelMemberPointMapper lumiereLevelMemberPointMapper;

    public List<LumiereLevelMemberPoint> listByUserId(Integer userId){
        LumiereLevelMemberPointExample example = new LumiereLevelMemberPointExample();
        if(userId != null){
            example.or().andUserIdEqualTo(userId);
        }else{
            example.or();
        }

        return lumiereLevelMemberPointMapper.selectByExample(example);
    }

    public void update(LumiereLevelMemberPoint lumiereLevelMemberPoint){
        lumiereLevelMemberPointMapper.updateByPrimaryKeySelective(lumiereLevelMemberPoint);
    }

    public void add(LumiereLevelMemberPoint lumiereLevelMemberPoint){
        lumiereLevelMemberPointMapper.insertSelective(lumiereLevelMemberPoint);
    }

    public List<LumiereLevelMemberPoint> list(LumiereLevelMemberPointExample example){
        return lumiereLevelMemberPointMapper.selectByExample(example);
    }
}
